﻿@{
    ViewBag.Title = "Form"; 
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    layui.use(['jquery', 'form', 'laydate', 'common','optimizeSelectOption'], function () {
        var form = layui.form,
            $ = layui.$,
            common = layui.common,
            laydate = layui.laydate;
        var keyValue = $.request("keyValue");
        //权限字段
        common.authorizeFields('adminform');
        //此处需修改
        //类型为时间时
     laydate.render({
              elem: '#F_StartDate'
             , btns: ['clear', 'now']
             , trigger: 'click',
             format: 'yyyy-MM-dd',
         });
            laydate.render({
                elem: '#F_EndDate'
              , btns: ['clear', 'now']
              , trigger: 'click',
              format: 'yyyy-MM-dd',
          });
        $(function () {
            initControl();
            if (!!keyValue) {
                 common.ajax({
                   url: '/RecruitmentManagement/Recruitmentplan/GetFormJson',
                   dataType: 'json',
                   data: { keyValue: keyValue },
                   async: false,
                   success: function (data) {
                       common.val('adminform', data);
                    }
               });
           }
           form.render();
       });
       wcLoading.close();

       function initControl() {
           //此处需修改
           //绑定数据源
           //类型为下拉框时
              $("#F_CompanyId").bindSelect({
                 url: "/SystemOrganize/SystemSet/GetListJson",
                 id: "F_Id",
                 text: "F_CompanyName"
             });
             $("#F_DutyId").bindSelect({
                 url: "/SystemOrganize/Duty/GetListJson",
                 id: "F_Id",
                 text: "F_FullName"
             });
       }

       //监听提交
       form.on('submit(saveBtn)', function (data) {
           var postData = data.field;
           common.submitForm({
               url: '/RecruitmentManagement/Recruitmentplan/SubmitForm?keyValue=' + keyValue,
               param: postData,
               success: function () {
                   common.parentreload('data-search-btn');
               }
           })
           return false;
       });
   });
     function search(fileds) {
         layui.use(['jquery', 'form', 'common'], function () {
             var form = layui.form,
                 $ = layui.$,
                 common = layui.common;
             //不同弹窗
             if (fileds == '部门') {
                 common.modalOpen({
                     title: "选择组织",
                     url: "/SystemOrganize/Organize/AddForm?name=" + "F_OrganizeName" + "&value=" + "F_OrganizeId" + "&ids=" + $('#F_OrganizeId').val() ,
                     width: "650px",
                     height: "600px",
                 });
             }
            
             else {
                 return false;
             }
         });
     }
</script>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">
            <div class="layui-form layuimini-form" lay-filter="adminform">
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">编号</label>
                   <div class="layui-input-block">
                        <input type="text" id="F_EnCode" name="F_EnCode" autocomplete="off" lay-verify="required" placeholder="请输入" class="layui-input">
                   </div>
               </div>
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">名称</label>
                   <div class="layui-input-block">
                        <input type="text" id="F_FullName" name="F_FullName" autocomplete="off" lay-verify="required" placeholder="请输入" class="layui-input">
                   </div>
               </div>
                <div class="layui-form-item">
                    <div class="layui-col-md4 layui-col-sm4 layui-hide">
                        <label class="layui-form-label required">公司</label>
                        <div class="layui-input-block">
                            <select id="F_CompanyId" name="F_CompanyId" lay-verify="required" lay-search="">
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md4 layui-col-sm4 layui-hide">
                        <label class="layui-form-label required">部门</label>
                        <div class="layui-input-block">
                            <input id="F_OrganizeName" name="F_OrganizeName" type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input" onclick="search('部门')" />
                            <input id="F_OrganizeId" name="F_OrganizeId" type="text" hidden />
                        </div>
                    </div>
                    <div class="layui-col-md4 layui-col-sm4 layui-hide">
                        <label class="layui-form-label required">岗位</label>
                        <div class="layui-input-block">
                            <select id="F_DutyId" name="F_DutyId" lay-verify="required" lay-search="">
                                <option value="">==请选择==</option>
                            </select>
                        </div>
                    </div>
                
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">人数</label>
                   <div class="layui-input-block">
                        <input type="text" id="F_Count" name="F_Count" autocomplete="off" lay-verify="required" placeholder="请输入" class="layui-input">
                   </div>
               </div>
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">开始时间</label>
                   <div class="layui-input-block">
                        <input type="text" id="F_StartDate" name="F_StartDate" autocomplete="off" lay-verify="required" placeholder="请输入" class="layui-input">
                   </div>
               </div>
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label required">结束时间</label>
                   <div class="layui-input-block">
                        <input type="text" id="F_EndDate" name="F_EndDate" autocomplete="off" lay-verify="required" placeholder="请输入" class="layui-input">
                   </div>
               </div>
                
                <div class="layui-form-item layui-hide">
                   <label class="layui-form-label ">备注</label>
                   <div class="layui-input-block">
                        <input type="text" id="F_Description" name="F_Description" autocomplete="off"  placeholder="请输入" class="layui-input">
                   </div>
               </div>
                
                <div class="layui-form-item layui-hide">
                    <button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</body>

